package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPressureQualifiedStandards;
import com.ruoyi.system.service.IDispatchPressureQualifiedStandardsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 压力合格标准Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPressureQualifiedStandards")
public class DispatchPressureQualifiedStandardsController extends BaseController
{
    @Autowired
    private IDispatchPressureQualifiedStandardsService dispatchPressureQualifiedStandardsService;

    /**
     * 查询压力合格标准列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureQualifiedStandards:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPressureQualifiedStandards dispatchPressureQualifiedStandards)
    {
        startPage();
        List<DispatchPressureQualifiedStandards> list = dispatchPressureQualifiedStandardsService.selectDispatchPressureQualifiedStandardsList(dispatchPressureQualifiedStandards);
        return getDataTable(list);
    }

    /**
     * 导出压力合格标准列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureQualifiedStandards:export')")
    @Log(title = "压力合格标准", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPressureQualifiedStandards dispatchPressureQualifiedStandards)
    {
        List<DispatchPressureQualifiedStandards> list = dispatchPressureQualifiedStandardsService.selectDispatchPressureQualifiedStandardsList(dispatchPressureQualifiedStandards);
        ExcelUtil<DispatchPressureQualifiedStandards> util = new ExcelUtil<DispatchPressureQualifiedStandards>(DispatchPressureQualifiedStandards.class);
        util.exportExcel(response, list, "压力合格标准数据");
    }

    /**
     * 获取压力合格标准详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureQualifiedStandards:query')")
    @GetMapping(value = "/{pressureQualifiedStandardsId}")
    public AjaxResult getInfo(@PathVariable("pressureQualifiedStandardsId") Long pressureQualifiedStandardsId)
    {
        return success(dispatchPressureQualifiedStandardsService.selectDispatchPressureQualifiedStandardsByPressureQualifiedStandardsId(pressureQualifiedStandardsId));
    }

    /**
     * 新增压力合格标准
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureQualifiedStandards:add')")
    @Log(title = "压力合格标准", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPressureQualifiedStandards dispatchPressureQualifiedStandards)
    {
        return toAjax(dispatchPressureQualifiedStandardsService.insertDispatchPressureQualifiedStandards(dispatchPressureQualifiedStandards));
    }

    /**
     * 修改压力合格标准
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureQualifiedStandards:edit')")
    @Log(title = "压力合格标准", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPressureQualifiedStandards dispatchPressureQualifiedStandards)
    {
        return toAjax(dispatchPressureQualifiedStandardsService.updateDispatchPressureQualifiedStandards(dispatchPressureQualifiedStandards));
    }

    /**
     * 删除压力合格标准
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureQualifiedStandards:remove')")
    @Log(title = "压力合格标准", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pressureQualifiedStandardsIds}")
    public AjaxResult remove(@PathVariable Long[] pressureQualifiedStandardsIds)
    {
        return toAjax(dispatchPressureQualifiedStandardsService.deleteDispatchPressureQualifiedStandardsByPressureQualifiedStandardsIds(pressureQualifiedStandardsIds));
    }
}
